<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition xmlns="http://www.w3.org/1999/xhtml">


        <f:subview id="contactBodyView">
            <f:loadBundle basename="kuzmenkov.oip.i18n.front.contactRes" var="contactBundle"/>

            <div class="pageTitle">
                <h:outputText value="#{contactBundle.pageTitle}"/>
            </div>
            <h:panelGroup rendered="#{contactController.isError}">
                <div class="pageError">
                    <h:outputText value="#{contactController.error}"/>
                </div>
            </h:panelGroup>


            <h:panelGroup rendered="#{moduleChoosingController.selectedModule == false}"
                    styleClass="pageMessage">
                <h:form >
                    <h:outputText value="#{contactBundle.selectModule1} "/>
                    <h:commandLink value=" #{contactBundle.selectModule2}" action="home"/>
                </h:form>
            </h:panelGroup>
            <h:panelGroup rendered="#{moduleChoosingController.selectedModule}">
                <h:panelGrid columns="2" width="700" border="0" columnClasses="sidebar,mainPanel">
                    <h:panelGroup id="contactSidebar">
                        <div class="producerLogo">
                            <!--This place is for logo-->
                            <h:graphicImage id="logo"
                                            alt="#{contactBundle.logoAlt} #{contactController.producerName}"
                                            value="#{contactController.logoImage}"
                                            height="#{contactController.logoHeight}"
                                            width="#{contactController.logoWidth}"/>
                        </div>
                    </h:panelGroup>

                    <h:panelGroup>
                        <div class="mainPanelTitle">
                            <h:outputText value="#{contactController.producerName}"/>
                        </div>
                        <div class="mainPanelContent">
                            <!--for each a contact-->
                            <ui:repeat value="#{contactController.contacts}" var="contact">


                                <div class="contact">
                                    <div class="titleOfContact">
                                        <h:outputText value="#{contact.name}"/>
                                    </div>
                                    <!-- for each a contact link -->
                                    <ui:repeat value="#{contact.links}" var="link">

                                        <h:panelGrid columns="2" rowClasses="contactLink"
                                                     columnClasses="contactName,contactValue">
                                            <h:outputText value="#{link.name}: " styleClass="contactName"/>
                                            <h:outputText value="#{link.value}" styleClass="contactValue"
                                                          rendered="#{!(link.isSite or link.isEmail)}"/>
                                            <h:outputLink value="#{link.value}" rendered="#{link.isSite}">
                                                <h:outputText value="#{link.value}"/>
                                            </h:outputLink>
                                            <h:outputLink value="mailto:#{link.value}" rendered="#{link.isEmail}">
                                                <h:outputText value="#{link.value}"/>
                                            </h:outputLink>
                                        </h:panelGrid>

                                    </ui:repeat>
                                </div>
                            </ui:repeat>
                        </div>
                        <h:form>
                            <div class="mainPanelInfo">

                                <h:commandLink class="mainPanelLink"
                                               value="#{contactBundle.imageProcessingLink}"
                                               action="image_processing"/>

                            </div>
                        </h:form>
                    </h:panelGroup>
                </h:panelGrid>
            </h:panelGroup>

        </f:subview>
    </ui:composition>

</jsp:root>